#include "PreCompile.hpp"
#include "LibBuildNGInit.hpp"
#include "PhysicalInputFiles.hpp"
#include "ContentModule.hpp"
#include "GeneratedFiles.hpp"
#include "SimpleTasks.hpp"
#include "Settings.hpp"

namespace BuildNG
{
  static bool libbuildng_initialized = false;

  void init_libbuildng(const Glib::ustring &settings_file)
  {
    assert(!libbuildng_initialized);
    assert(is_shared_initialized());

    BuildNG::Settings::init(settings_file);
    BuildNG::PhysicalInputFiles::init();
    BuildNG::ContentModule::init();
    BuildNG::GeneratedFiles::init();
    BuildNG::CopyTask::init();
    
    libbuildng_initialized = true;
  }

  void shutdown_libbuildng()
  {
    if(!libbuildng_initialized)
      return;
    libbuildng_initialized = false;

    BuildNG::CopyTask::shutdown();
    BuildNG::GeneratedFiles::shutdown();
    BuildNG::ContentModule::shutdown();
    BuildNG::PhysicalInputFiles::shutdown();
    BuildNG::Settings::shutdown();
  }

  bool is_libbuildng_initialized()
  {
    return libbuildng_initialized;
  }
}

